<template>
	<view class="content" v-if="show==1">
		<view class="top">
			<view class="top_head">
				<image :src="user.avatar" mode="aspectFill"></image>
				<view class="head2">
					<view class="head3">{{user.nickname}}</view>
					<view class="head4">编号：{{user.dl_no}}</view>
					<view class="head4">到期：{{user.dl_endtime}}</view>
				</view>
			</view>
			<view class="yaoti">
				<view class="yaoti2" @click="url" data-url="/pages/user/tixian">我要提现</view>
			</view>
		    <view class="top_1">
		      <view class="yue">
		        <view class="yue_1">
		          <view class="mingcheng">可提现余额(元)</view>
		          <view class="qian">{{user.dl_money}}</view>
		        </view>
		      </view>
			  <view class="yue">
			    <view class="yue_1">
			      <view class="mingcheng">累计收益(元)</view>
			      <view class="qian">{{user.dl_total}}</view>
			    </view>
			  </view>
		    </view>
		</view>
		
		<view class="nav">
			<!-- #ifdef MP-WEIXIN -->
			<button class="nav2 hb6" type="default" open-type="share" plain="true" >
				<image src="../../static/images/dl_1.png" mode="aspectFit"></image>
				<view class="nav2-1">邀请好友</view>
			</button>
			<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<view class="nav2" @click="fx">
				<image src="../../static/images/dl_1.png" mode="aspectFit"></image>
				<view class="nav2-1">邀请好友</view>
			</view>
			<!-- #endif -->
			
			<view class="nav2" @click="url" data-url="/pages/user/txlists">
				<image src="../../static/images/dl_3.png" mode="aspectFit"></image>
				<view class="nav2-1">提现记录</view>
			</view>
			<view class="nav2" @click="url" data-url="/pages/user/dllog">
				<image src="../../static/images/dl_4.png" mode="aspectFit"></image>
				<view class="nav2-1">收益记录</view>
			</view>
			<view class="nav2" @click="url" data-url="/pages/user/dluser">
				<image src="../../static/images/dl_5.png" mode="aspectFit"></image>
				<view class="nav2-1">我的会员</view>
			</view>
			<view class="nav2" @click="shang">
				<image src="../../static/images/dl_7.png" mode="aspectFit"></image>
				<view class="nav2-1">谁邀请我</view>
			</view>
			<view class="nav2" @click="url" data-url="/pages/user/xufei">
				<image src="../../static/images/dl_2.png" mode="aspectFit"></image>
				<view class="nav2-1">我要续费</view>
			</view>
			
		</view>
		
		
		<view class="guize">
			<view class="guize2">代理规则</view>
			<view class="guize3"><text>{{site.dl_guize}}</text></view>
		</view>
		
		<view class="kefu" @click='fx' v-if="is_fx==true"></view>
		<view class="fx" v-if="is_fx==true">
		  <view class="fx2" @click="fenxiang(1)">
			  <image src="../../static/wx.png" mode="aspectFit"></image>
			  <view class="fx3">微信好友</view>
		  </view>
		  <view class="fx2" @click="fenxiang(2)">
			  <image src="../../static/peng.png" mode="aspectFit"></image>
			  <view class="fx3">朋友圈</view>
		  </view>
		</view>
		
		<view class="kefu" @click='ssclose' v-if="is_ss==true"></view>
		<view class="shangsi" @click='ssclose' v-if="is_ss==true">
			<!--<image :src="user.puser.avatar" mode="aspectFill"></image>-->
			<view class="shangsi2">邀请您的代理编号为：{{user.puser.id?user.puser.id:'暂无'}}</view>
		</view>
	</view>
</template>

<script>
	var app=getApp();
	export default {
		data() {
			return {
				show:0,
				uid:0,
				is_ss:false,
				site:[],
				is_fx:false,
				is_fx2:false,
				user:[]
			}
		},
		onShow() {
			const uid = uni.getStorageSync('uid');
			if(app.isBlank(uid)==true){
				app.error_msg("请先登录");
			}
			this.uid=uid;
			this.getdata();
		},
		methods: {
			getdata(){
				var that=this;
				/*uni.showLoading({
				    title: '数据加载中'
				});*/
				uni.request({
				    url: app.globalData.url+"user/daili",
					method:"POST",
					dataType:"json",
					header: {
					    'content-type': 'application/x-www-form-urlencoded'
					},
				    data: {uid:that.uid},
				    success: (res) => {
						uni.hideLoading();
						if(res.data.code!=1){
							app.error_msg(res.data.msg);
						}
						that.user=res.data.data.user
						that.site=res.data.data.site
						
						that.show=1;
				    }
				});
			},
			shang(){
				this.is_ss=true;
				/*if(app.isBlank(this.user.puser)==false){
					this.is_ss=true;
				}else{
					uni.showToast({
					    title: '您没有上司',
						icon:'none',
					    duration: 1000
					});
				}*/
			},
			ssclose(){
				this.is_ss=false;
			},
			fx(){
				var that=this;
				uni.share({
				    provider: 'weixin',
				    scene: "WXSceneSession",
				    type: 5,
				    imageUrl: that.site.dl_fx_img,
				    title: that.site.dl_fx_title,
				    miniProgram: {
				        id: 'gh_e35b785da324',
				        path: 'pages/index/index?uid='+that.uid,
				        type: 0,
				        webUrl: 'https://www.bjfen.com'
				    },
				    success: ret => {
				        console.log(JSON.stringify(ret));
				    }
				});
			},
			fenxiang(t){
				var that=this;
				if(t==1){
					var that=this;
					uni.share({
					    provider: 'weixin',
					    scene: "WXSceneSession",
					    type: 5,
					    imageUrl: that.site.dl_fx_img,
					    title: that.site.dl_fx_title,
					    miniProgram: {
					        id: 'gh_e35b785da324',
					        path: 'pages/index/index?uid='+that.uid,
					        type: 0,
					        webUrl: 'https://www.bjfen.com'
					    },
					    success: ret => {
					        console.log(JSON.stringify(ret));
					    }
					});
				}else{
					var that=this;
					uni.share({
					    provider: 'weixin',
					    scene: "WXSceneTimeline",
					    type: 5,
					    imageUrl: that.site.dl_fx_img,
					    title: that.site.dl_fx_title,
					    miniProgram: {
					        id: 'gh_e35b785da324',
					        path: 'pages/index/index?uid='+that.uid,
					        type: 0,
					        webUrl: 'https://www.bjfen.com'
					    },
					    success: ret => {
					        console.log(JSON.stringify(ret));
					    }
					});
				}
			},
			url(e){
				var url=e.currentTarget.dataset.url;
				uni.navigateTo({
				    url: url
				});
			},
			onShareAppMessage(res) {
				var that=this;
			    return {
			      title: that.site.dl_fx_title,
				  imageUrl:that.site.dl_fx_img,
			      path: '/pages/index/index?uid='+that.uid
			    }
			}
		}
	}
</script>

<style>
	.yaoti2{width:100px;height:30px;line-height: 30px;text-align: center;border:1px #fff solid;border-radius: 5px;color:#fff;margin: 0 auto;margin-top: 15px;}
	.yaoti{width:100%;}
	.shangsi2{width:90%;height:50px;line-height: 50px;margin: 0px auto;overflow: hidden;}
	.shangsi image{width:80px;height:80px;border-radius: 50%;margin-top: 20px;}
	.shangsi{width:250px;height:50px;position: fixed;top:50%;margin-top: -25px;left:50%;margin-left: -125px;background-color: #fff;border-radius: 5px;z-index: 9999;text-align: center;}
	.nav2-1{width:100%;height:25px;line-height: 25px;font-size: 0.9rem;}
	.nav2 image{width:30px;height:30px;}
	.nav2{width:33.33%;float: left;text-align: center;margin-top: 25px;border:0px!important;height:55px;}
	.hb6{padding: 0px;line-height: unset;}
	.nav{width:100%;overflow: hidden;}
	
	.fx5{width:200px;position: fixed;top:0px;right:0px;z-index:9999;}
	.fx3{width:100%;height:30px;line-height: 30px;}
	.fx2 image{width:60px;height:60px;}
	.fx2{width:50%;float: left;text-align: center;margin: 25px 0px;}
	.fx{width:100%;height:150px;position: fixed;bottom: 0px;z-index: 9999;background-color: #fff;overflow: hidden;}
	.kefu{width:100%;height:100vh;position: fixed;top:0px;z-index: 9999;background-color: #000000;opacity: 0.7;}
	
	.guize3{width:94%;margin: 0px 3%;line-height: 25px;margin-bottom: 10px;}
	.guize2{width:100%;height:50px;line-height: 50px;color:#333;font-size: 0.9rem;font-weight: 550;text-align: center;}
	.guize{width:94%;margin: 10px 3%;border-radius: 5px;background-color: #fff;margin-top: 25px;}
	
	.anniu{width:94%;margin: 10px auto;background-color: #fff;border-radius: 5px;}
	.daoqi2-2{height:35px;line-height: 30px;margin-right: 15px;font-size: 0.9rem;text-align: right;}
	.daoqi2-1{height:25px;line-height: 33px;margin-right: 15px;color:#666;text-align: right;}
	.daoqi4{width:80px;height:30px;line-height: 30px;text-align: center;background-color: #fb91a8;color:#fff;margin-top: 15px;float: right;margin-left: 15px;border-radius: 3px;}
	.daoqi2{width:100%;height:60px;flex:1;}
	.daoqi3{width:100px;height:60px;}
	.daoqi{width:94%;margin: 0 auto;background-color: #fff;height:60px;border-radius: 8px;margin-top: -30px;display: flex;box-shadow:1px 1px 2px #eee;}
	
	.head4{width:100%;height:20px;line-height: 20px;color:#fff;overflow: hidden;}
	.head3{width:100%;height:20px;line-height: 20px;font-size: 0.9rem;color:#fff;overflow: hidden;}
	.head2{width:100%;height:60px;flex:1;}
	.top_head image{width:60px;height:60px;margin-right: 10px;border-radius: 50%;}
	.top_head{width:95%;display: flex;margin: 0 auto;margin-top: 15px;}
	
	.dao2 text{color:red;font-size: 0.7rem;margin-left: 5px;float: right;}
	.dao:last-child{border:0px;}
	.tubiao2{width:20px;height:20px;margin-top: 9px;}
	.dao2{width:100%;height:38px;line-height: 38px;flex:1;font-size: 0.95rem;}
	.tubiao{width:20px;height:20px;margin-top: 9px;margin-right: 8px;}
	.dao{width:94%;padding: 3px 3%;display: flex;height:38px;border-bottom:1px rgb(245, 245, 245) solid;}
	
	.kong{width:100%;text-align: center;margin-top: 30%;}
	.active{border-bottom: 2px #fb91a8 solid;color:#fb91a8;}
	.qian2{width:40%;margin:0px 5%;height:30px;line-height: 30px;text-align: center;float: left;}
	.qian1{width:100%;overflow: hidden;}
	.bottom{width:94%;padding: 0px 3%;}
	.sign_1{width:100%;overflow: hidden;padding: 10px 0px;border-bottom: 1px rgb(245, 245, 245) solid;overflow: hidden;}
	.time{width:70%;float: left;height:50px;}
	.jifen2{width:30%;float: left;height:50px;line-height: 50px;color:rgb(7, 207, 33);font-size: 0.9rem;text-align: right;}
	.time_1{width:100%;height:30px;line-height: 30px;font-size: 0.8rem;color:#666;overflow: hidden;}
	.time_2{width:100%;height:30px;line-height: 20px;color:#999;}
	.red{color:red!important;}
	.top{width:94%;padding: 0px 3%;background-color: #1196db;}
	.top_1{width:100%;height:auto;overflow: hidden;}
	.yue{width:46%;padding: 15px 2%;overflow: hidden;float: left;}
	.yue_1{width:100%;}
	.yue_2{width:30%;float: left;text-align: right;margin-top: 13px;}
	.mingcheng{width:100%;height:20px;line-height: 20px;color:#eee;text-align: center;}
	.qian{width:100%;height:35px;line-height: 35px;color:#fff;font-size: 1.5rem;overflow: hidden;text-align: center;}
	
</style>
